<template>
  <el-row>
    <el-form :model="returnedSearchObj" label-width="120px" class="search_prod">
      <el-form-item label="用户昵称">
        <el-col :span="4">
          <el-col :span="16" class="search_input_width">
            <el-input size="small" clearable v-model="returnedSearchObj.nickname" placeholder="用户昵称"></el-input>
          </el-col>
        </el-col>
        <el-col class="tr col_label" :span="3">会员账号&nbsp;&nbsp;&nbsp;</el-col>
        <el-col :span="4">
          <el-col :span="16" class="search_input_width">
            <el-input size="small" clearable v-model="returnedSearchObj.username" placeholder="会员账号"></el-input>
          </el-col>
        </el-col>
        <el-col class="tr col_label" :span="3">商品名称&nbsp;&nbsp;&nbsp;</el-col>
        <el-col :span="4">
          <el-col :span="16" class="search_input_width">
            <el-input size="small" clearable v-model="returnedSearchObj.pid_cn" placeholder="商品名称"></el-input>
          </el-col>
        </el-col>
      </el-form-item>
      <el-form-item label="商品ID">
        <el-col :span="4">
          <el-col :span="16" class="search_input_width">
            <el-input size="small" clearable v-model="returnedSearchObj.pid" placeholder="商品ID"></el-input>
          </el-col>
        </el-col>
        <el-col class="tr col_label" :span="3">订单号&nbsp;&nbsp;&nbsp;</el-col>
        <el-col :span="4">
          <el-col :span="16" class="search_input_width">
            <el-input size="small" clearable v-model="returnedSearchObj.oid" placeholder="订单号"></el-input>
          </el-col>
        </el-col>
        <el-col class="tr col_label" :span="3">申请状态&nbsp;&nbsp;&nbsp;</el-col>
        <el-col :span="4">
          <el-col :span="16" class="search_input_width">
            <el-select v-model="returnedSearchObj.status" clearable size="small" placeholder="申请状态">
              <el-option v-for="item in statusList" size="small" :key="item.id" :label="item.title" :value="item.id"></el-option>
            </el-select>
          </el-col>
        </el-col>
      </el-form-item>
      <el-form-item>
        <el-row class="tl">
          <el-col :span="24">
            <el-button :loading="$store.state.isLoading" size="small" type="primary" @click="onSubmit">查询</el-button>
            <el-button :loading="$store.state.isLoading" size="small" type="primary" @click="delSubmit">一键清除</el-button>
          </el-col>
        </el-row>
      </el-form-item>
    </el-form>
  </el-row>
</template>
<script>
export default {
  name: "productSearch",
  props: ["oid"],
  data() {
    return {
      statusList: [
        { id: 1, title: "申请退货" },
        { id: 2, title: "允许退货" },
        { id: 3, title: "已退货待退款" },
        { id: 4, title: "退货成功" },
        { id: 5, title: "驳回" },
        { id: 6, title: "仅退款" },
      ],
      returnedSearchObj: {
        username: "",
        nickname: "",
        pid_cn: "",
        pid: "",
        oid: "",
        status: "",
      },
    };
  },
  methods: {
    delSubmit() {
      this.returnedSearchObj = {
        username: "",
        nickname: "",
        pid_cn: "",
        pid: "",
        oid: "",
        status: "",
      };
      this.$emit("sendSearch", this.returnedSearchObj);
    },
    onSubmit() {
      this.$emit("sendSearch", this.returnedSearchObj);
    },
  },
  created() {
    if (this.oid) {
      this.returnedSearchObj.oid = this.oid;
    }
  },
  watch: {},
};
</script>
